package com.design.proxy.dynamic;

import com.design.proxy.Person;
import com.design.proxy.st.Student;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Proxy;

/**
 * Created by yijy on 2018/3/20.
 */
public class DynamicMain {
    public static void main(String[] args) {
        Student student = new Student("张三");
        InvocationHandler h = new DynamicProxy(student);
        Class<?> clz = student.getClass();
        System.out.println(clz.getClassLoader().toString()+"\n"+clz.getInterfaces().toString());
        Person person = (Person) Proxy.newProxyInstance(clz.getClassLoader(),clz.getInterfaces(),h);
        person.submitFee();
    }
}
